/*
 *此javaCode由YMS-JDBC替换工具生成，原mapper位置com.yonyou.ucf.mdf.app.isvdxq.other.mapper.TranstypeMapper
 */
package com.yonyou.ucf.mdf.app.isvdxq.other.mapper.impl;

import com.yonyou.iuap.yms.api.IYmsJdbcApi;
import com.yonyou.iuap.yms.param.*;
import com.yonyou.iuap.yms.param.ResultSetProcessor;
import com.yonyou.iuap.yms.processor.*;
import com.yonyou.ucf.mdf.app.isvdxq.other.entity.TranstypeEntity;
import java.sql.Types;
import java.util.*;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;

@Repository
public class TranstypeMapperImpl {
    
    @Autowired
    private IYmsJdbcApi ymsJdbcApi;
    //com.yonyou.ucf.mdf.app.isvdxq.other.mapper.TranstypeMapper.selectAll
    
    public List<TranstypeEntity> selectAll() {
        SQLParameter parameter = new SQLParameter(true);
        
        String sql = "select * from dxqyy_transtype where `enable`=1;\n";
        
        ResultSetProcessor processor = new AutoBeanListProcessor(new TranstypeEntity());
        return (List<TranstypeEntity>) ymsJdbcApi.queryForList(sql, parameter, processor);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.other.mapper.TranstypeMapper.updateByPrimaryKey
    
    public int updateByPrimaryKey(TranstypeEntity record) {
        SQLParameter parameter = new SQLParameter(true);
        
        String sql = "update dxqyy_transtype set `sourceid` = ?, `sysid` = ?, `code` = ?, `name` = ?, `name_resid` = ?, `billtype_id` = ?, `extend_attrs_json` = ?, `preset` = ?, `enable` = ?, `is_nosupport_transtypadd` = ?, `is_nosupport_transtypmodify` = ?, `is_nosupport_transtypdel` = ?, `is_nosupport_transtyprefmodify` = ?, `is_support_publish_menu` = ?, `is_support_workflow` = ?, `print_after_approval` = ?, `ytenant_id` = ?, `memo` = ?, `memo_resid` = ?, `dr` = ? where `id` = ?\n";
        parameter.addParamWithType(record.getSourceid(), Types.VARCHAR);
		parameter.addParamWithType(record.getSysid(), Types.VARCHAR);
		parameter.addParamWithType(record.getCode(), Types.VARCHAR);
		parameter.addParamWithType(record.getName(), Types.VARCHAR);
		parameter.addParamWithType(record.getName_resid(), Types.VARCHAR);
		parameter.addParamWithType(record.getBilltype_id(), Types.VARCHAR);
		parameter.addParamWithType(record.getExtend_attrs_json(), Types.VARCHAR);
		parameter.addParamWithType(record.getPreset(), Types.INTEGER);
		parameter.addParamWithType(record.getEnable(), Types.INTEGER);
		parameter.addParamWithType(record.getIs_nosupport_transtypadd(), Types.INTEGER);
		parameter.addParamWithType(record.getIs_nosupport_transtypmodify(), Types.INTEGER);
		parameter.addParamWithType(record.getIs_nosupport_transtypdel(), Types.INTEGER);
		parameter.addParamWithType(record.getIs_nosupport_transtyprefmodify(), Types.INTEGER);
		parameter.addParamWithType(record.getIs_support_publish_menu(), Types.INTEGER);
		parameter.addParamWithType(record.getIs_support_workflow(), Types.INTEGER);
		parameter.addParamWithType(record.getPrint_after_approval(), Types.INTEGER);
		parameter.addParamWithType(record.getYtenant_id(), Types.VARCHAR);
		parameter.addParamWithType(record.getMemo(), Types.VARCHAR);
		parameter.addParamWithType(record.getMemo_resid(), Types.VARCHAR);
		parameter.addParamWithType(record.getDr(), Types.SMALLINT);
		parameter.addParamWithType(record.getId(), Types.BIGINT);

        
        return ymsJdbcApi.update(sql, parameter);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.other.mapper.TranstypeMapper.selectCount
    
    public int selectCount(long id) {
        SQLParameter parameter = new SQLParameter(true);
        
        String sql = "select count(1) from dxqyy_transtype where `id`=?;\n";
        parameter.addParam(id);

        ResultSetProcessor processor = new ColumnProcessor(int.class);
        return (int) ymsJdbcApi.queryForObject(sql, parameter, processor);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.other.mapper.TranstypeMapper.insert
    
    public int insert(TranstypeEntity record) {
        SQLParameter parameter = new SQLParameter(true);
        
        String sql = "insert into dxqyy_transtype (`id`, `sourceid`,  `sysid`, `code`, `name`,  `name_resid`, `billtype_id`,  `extend_attrs_json`, `preset`,  `enable`, `is_nosupport_transtypadd`,  `is_nosupport_transtypmodify`, `is_nosupport_transtypdel`,  `is_nosupport_transtyprefmodify`, `is_support_publish_menu`,  `is_support_workflow`, `print_after_approval`, `ytenant_id`,  `memo`, `memo_resid`,  `dr`) values (?, ?,  ?, ?, ?,  ?, ?,  ?, ?,  ?, ?,  ?, ?,  ?, ?,  ?, ?,  ?, ?,  ?, ?,  ?)\n";
        parameter.addParamWithType(record.getId(), Types.BIGINT);
		parameter.addParamWithType(record.getSourceid(), Types.VARCHAR);
		parameter.addParamWithType(record.getSysid(), Types.VARCHAR);
		parameter.addParamWithType(record.getCode(), Types.VARCHAR);
		parameter.addParamWithType(record.getName(), Types.VARCHAR);
		parameter.addParamWithType(record.getName_resid(), Types.VARCHAR);
		parameter.addParamWithType(record.getBilltype_id(), Types.VARCHAR);
		parameter.addParamWithType(record.getExtend_attrs_json(), Types.VARCHAR);
		parameter.addParamWithType(record.getPreset(), Types.INTEGER);
		parameter.addParamWithType(record.getEnable(), Types.INTEGER);
		parameter.addParamWithType(record.getIs_nosupport_transtypadd(), Types.INTEGER);
		parameter.addParamWithType(record.getIs_nosupport_transtypmodify(), Types.INTEGER);
		parameter.addParamWithType(record.getIs_nosupport_transtypdel(), Types.INTEGER);
		parameter.addParamWithType(record.getIs_nosupport_transtyprefmodify(), Types.INTEGER);
		parameter.addParamWithType(record.getIs_support_publish_menu(), Types.INTEGER);
		parameter.addParamWithType(record.getIs_support_workflow(), Types.INTEGER);
		parameter.addParamWithType(record.getPrint_after_approval(), Types.INTEGER);
		parameter.addParamWithType(record.getYtenant_id(), Types.VARCHAR);
		parameter.addParamWithType(record.getMemo(), Types.VARCHAR);
		parameter.addParamWithType(record.getMemo_resid(), Types.VARCHAR);
		parameter.addParamWithType(record.getDr(), Types.SMALLINT);

        
        return ymsJdbcApi.update(sql, parameter);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.other.mapper.TranstypeMapper.deleteByPrimaryKey
    
    public int deleteByPrimaryKey(Long id) {
        SQLParameter parameter = new SQLParameter(true);
        
        String sql = "delete from dxqyy_transtype where `id` = ?\n";
        parameter.addParamWithType(id, Types.BIGINT);

        
        return ymsJdbcApi.update(sql, parameter);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.other.mapper.TranstypeMapper.selectById
    
    public TranstypeEntity selectById(long id) {
        SQLParameter parameter = new SQLParameter(true);
        
        String sql = "select * from dxqyy_transtype where `id`=?;\n";
        parameter.addParam(id);

        ResultSetProcessor processor = new AutoBeanProcessor(new TranstypeEntity());
        return (TranstypeEntity) ymsJdbcApi.queryForObject(sql, parameter, processor);
    }

}
